import request from '@/utils/request';

// 页面管理新增
export function addPageInfo(data) {
  return request({
    url: '/toolkit/pageInfo/save',
    method: 'post',
    data: data
  })
}

// 页面管理删除
export function delPageInfo(data) {
  return request({
    url: '/toolkit/pageInfo/remove/' + data,
    method: 'delete'
  })
}

// 页面管理修改
export function editPageInfo(data) {
  return request({
    url: '/toolkit/pageInfo/update',
    method: 'put',
    data: data
  })
}

// 页面管理查询
export function listPageInfo(query) {
  return request({
    url: '/toolkit/pageInfo/list',
    method: 'get',
    params: query
  })
}

// 页面管理查询树结构
export function treePageInfo(query) {
  return request({
    url: '/toolkit/pageInfo/pageTree',
    method: 'get',
    params: query
  })
}

// 获取菜单树
export function getMenuTree(query) {
  return request({
    url: '/toolkit/pageInfo/getMenuTree',
    method: 'get',
    params: query
  })
}

// 根据groupId查询页面管理数据
export function getPageInfo(id) {
  return request({
    url: '/toolkit/pageInfo/' + id,
    method: 'get'
  })
}

// 根据code获取表单信息
export function getByCode(query) {
  return request({
    url: '/toolkit/pageInfo/getByCode',
    method: 'get',
    params: query
  })
}

// 判断表单名称是否存在
export function checkName(parameter) {
  return request({
    url: '/toolkit/pageInfo/checkName',
    method: 'post',
    data: parameter
  })
}

// 页面数据查询
export function listGenerate(query) {
  return request({
    url: '/toolkit/pageInfo/genList',
    method: 'get',
    params: query
  })
}

export function genByCode(query) {
  return request({
    url: '/toolkit/pageInfo/genByCode',
    method: 'get',
    params: query
  })
}

export function saveGenerate(data) {
  return request({
    url: '/toolkit/pageInfo/genSave',
    method: 'post',
    data: data
  })
}

export function deGenerate(params) {
  return request({
    url: '/toolkit/pageInfo/genDel',
    method: 'delete',
    params: params
  })
}
